package com.ruoyi.back.controller

import com.ruoyi.app.common.Data
import com.ruoyi.app.common.PageData
import com.ruoyi.app.common.pageInfo
import com.ruoyi.back.domain.BootPage
import com.ruoyi.back.service.BootPageService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiImplicitParam
import io.swagger.annotations.ApiImplicitParams
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("system/bootPage")
@Api(tags = ["广告管理-启动页"])
class BootPageController {


    @Autowired
    private lateinit var bootPageService: BootPageService


    @ApiOperation("保存启动页")
    @PostMapping("save")
    fun saveBootPage(@RequestBody bootPage: BootPage): Data<Boolean> = bootPageService.saveBootPage(bootPage)

    @ApiOperation("启动页分页")
    @GetMapping("list")
    fun bootPagePage(): PageData<BootPage> = bootPageService.bootPagePage().pageInfo()

    @ApiOperation("批量移除启动页")
    @ApiImplicitParams(
        ApiImplicitParam(name = "bootPageIds", value = "启动页id 多个使用逗号", type = "path", required = true)
    )
    @PostMapping("remove/{bootPageIds}")
    fun removeBootPage(@PathVariable bootPageIds: String): Data<Boolean> = bootPageService.removeBootPage(bootPageIds)


}